<?php
/*
 * @Author: your name
 * @Date: 2021-11-03 15:16:15
 * @LastEditTime: 2022-02-25 16:03:46
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \property\app\Models\admin_model\Column.php
 */

namespace App\Models\crm_model;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class CrmRole extends Model
{
    use HasFactory;
    static string $tableName = 'crm_role';

    public static function list($whereStr = '', $limitStr = '',$field='*')
    {

        return DB::select(' SELECT '.$field.' FROM ' . self::$tableName . '   WHERE  `delete_time` is null ' . $whereStr . ' ORDER BY `top_time` DESC,`id` DESC  ' . $limitStr);
    }
    
    public static function selectList($field, $whereStr){
        return DB::select(' SELECT '.$field.' FROM ' . self::$tableName . '   WHERE  `delete_time` is null   '.$whereStr.'  ORDER BY `top_time` DESC,`id` DESC  ');

    }


    public static function count($whereStr = '')
    {
        return DB::select(' SELECT COUNT(*) as `count` FROM ' . self::$tableName . '   WHERE `delete_time` is null ' . $whereStr);
    }

    
}
